package com.payfen.client.action;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.payfen.client.jsonbean.ResultBean;
import com.payfen.util.FileTool;

@Controller
public class ClientShopsOrderInfAction extends Action {
	@RequestMapping(value = "/shopsSubmitOrder", method = RequestMethod.POST)
	public void preAuth(HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		request.setCharacterEncoding("UTF-8");
		response.setCharacterEncoding("UTF-8");
		PrintWriter out = response.getWriter();

		String msg = "";
		try {
			String merchantId = getRequestParameter(request, "merchantId");
			String orderNo = getRequestParameter(request, "orderNo");
			String refenceNo = getRequestParameter(request, "refenceNo");
			String shopsNo = getRequestParameter(request, "shopsNo");
			String shopsName = getRequestParameter(request, "shopsName");
			String productNo = getRequestParameter(request, "productNo");
			String productName = getRequestParameter(request, "productName");
			String amount = getRequestParameter(request, "amount");
			String cardNo = getRequestParameter(request, "cardNo");
			String memberCard = getRequestParameter(request, "memberCard");
			String consumeType = getRequestParameter(request, "consumeType");
			String integral = getRequestParameter(request, "integral");
			String activityNo = getRequestParameter(request, "activityNo");
			String operator = getRequestParameter(request, "operator");

			if (merchantId != null && !merchantId.trim().equals("") && orderNo != null && !orderNo.trim().equals("")
					&& refenceNo != null && !refenceNo.trim().equals("") && shopsNo != null && !shopsNo.trim().equals("")
					&& productNo != null && !productNo.trim().equals("") && amount != null && !amount.trim().equals("")
					&& memberCard != null && !memberCard.trim().equals("")
					&& consumeType != null && !consumeType.trim().equals("")
					&& operator != null && !operator.trim().equals("")
				) {
				msg = ResultBean.createReturnJson("0000", "操作成功",null);
			} else {
				msg = ResultBean.createReturnJson("0004", FileTool.getErrorCodeFromProperties("0002"),null);
			}
		} catch (Exception e) {
			e.printStackTrace();
			msg = ResultBean.createReturnJson("0002", FileTool.getErrorCodeFromProperties("0002"),null);
		}
		out.write(msg);
		out.flush();
		out.close();
	}
}
